//
//  Sample.swift
//  CooperSwift_Example
//
//  Created by 计海峰 on 2021/4/26.
//  Copyright © 2021 CocoaPods. All rights reserved.
//

import Foundation
//import WCDBSwift

class Sample : TableCodable {
    var identifier: Int!
    var description: String? = nil
    var offset: Int = 0
    var content: String? = nil
    var title: String = ""
    
    enum CodingKeys: String, CodingTableKey {
        typealias Root = Sample
        static let objectRelationalMapping = TableBinding(CodingKeys.self)
        case identifier
        case description
        case title
        case content
        case offset = "db_offset"
        
        static var columnConstraintBindings: [Sample.CodingKeys : ColumnConstraintBinding]? {
            return [
                identifier: ColumnConstraintBinding(isPrimary: true),
                title: ColumnConstraintBinding(isNotNull: true, defaultTo: "")
            ]
        }
        
        static var indexBindings: [IndexBinding.Subfix : IndexBinding]?
        
    }
    
    var isAutoIncrement: Bool = true // 用于定义是否使用自增的方式插入
    var lastInsertedRowID: Int64 = 0 // 用于获取自增插入后的主键值
    
}
